package lec02.am.ex;

public class Function {

	private static final int SIZE = 100;

	public static void solve() {
		int a, b, c, d, e, f;
		for (a = 1; a <= SIZE; a++)
			for (b = a; b <= SIZE; b++)
				for (c = b; c <= SIZE; c++)
					for (d = c; d <= SIZE; d++)
						for (e = d; e <= SIZE; e++)
							for (f = e + 1; f <= SIZE; f++) {
								if (h(a) + h(b) + h(c) + h(d) + h(e) == h(f)) {
									System.out.println(String.format(
											"%d^5+%d^5+%d^5+%d^5=%d^5",
											a, b, c, d, e, f));
								}
							}

	}

	private static long h(int a) {
		return 1L * a * a * a * a * a;
	}

}
